import com.zeng.dao.NewUser;
import com.zeng.dao.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author zeng
 * @data 2021/06/09 11:59
 */
public class Mytest {
    public static void main(String[] args) {
        //传入的是一个类,纯注解,getBean填新建对象的方法名,与之前的对象名不一样
        ApplicationContext context = new AnnotationConfigApplicationContext(NewUser.class);
        User user = context.getBean("getUser", User.class);
        System.out.println(user.getName());
    }
}
